#ifndef _BASE64_H_
#define _BASE64_H_

#ifdef __cplusplus
extern "C"{
#endif

#include <stdio.h>

/* --------------------------------------------------------------------------*/
/**
 * @Synopsis base64 encode
 *
 * @Param src data before encode
 * @Param length data length
 *
 * @Returns data after encoded, need free.
 */
/* ----------------------------------------------------------------------------*/
extern char *base64_encode(char *src, int length);

/* --------------------------------------------------------------------------*/
/**
 * @Synopsis base64 decode
 *
 * @Param dest data encoded
 *
 * @Returns data decoded
 */
/* ----------------------------------------------------------------------------*/
extern char *base64_decode(char *src, int *destlen);

// 删除字符串in中所有的target并保存到in中
void delete_char(char in[], int inlen, const char target);

void printf_error(const char *format, ...);
void printf_success(const char *format, ...);
void printf_warning(const char *format, ...);
void printf_info(const char *format, ...);
void printf_debug(const char *format, ...);

void set_log_file_handler(FILE *fp);

void flag_debug_set(int flag);
void flag_success_set(int flag);
void flag_info_set(int flag);

#ifdef __cplusplus
}
#endif

#endif // _BASE64_H_
